STEP 7: Let's use the value of x (the x-coordinate of the mouse) to set the width of the rectangle.

  • In the GRAPHICS tab, click on .
  • Drag out Set Width. Drop it inside the mouse_move block, right below ····y·=·stage.mouse_y()¬.
  • Change the variable before .set_width() from sprite to my_rect to assign .set_width() to my_rect.

A command is inside an event if it is indented 4 spaces or 1 tab and has a ····¬ in front of it.

To navigate the page using the TAB key, first press ESC to exit the code editor.

# THIS ACTIVITY IS IN PREVIEW ONLY MODE
  • Run Code
  • Submit Work
  • Next Activity
  • Show Console
  • Reset Code Editor
  • Codesters How To (opens in a new tab)